/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cse308.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aaron
 */
@Entity
@Table(catalog = "nchorn", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Peoattainment.findAll", query = "SELECT p FROM Peoattainment p"),
    @NamedQuery(name = "Peoattainment.findByIdpeoattainment", query = "SELECT p FROM Peoattainment p WHERE p.idpeoattainment = :idpeoattainment"),
    @NamedQuery(name = "Peoattainment.findByAttainmentlevel", query = "SELECT p FROM Peoattainment p WHERE p.attainmentlevel = :attainmentlevel"),
    @NamedQuery(name = "Peoattainment.findByYea", query = "SELECT p FROM Peoattainment p WHERE p.yea = :yea")})
public class Peoattainment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(nullable = false, length = 20)
    private String idpeoattainment;
    @Size(max = 45)
    @Column(length = 45)
    private String attainmentlevel;
    @Size(max = 20)
    @Column(length = 20)
    private String yea;
    @JoinColumn(name = "surveyidentifier", referencedColumnName = "identifier")
    @ManyToOne
    private Survey surveyidentifier;
    @JoinColumn(name = "peoIdentifier", referencedColumnName = "identifier")
    @ManyToOne
    private Peo peoIdentifier;

    public Peoattainment() {
    }

    public Peoattainment(String idpeoattainment) {
        this.idpeoattainment = idpeoattainment;
    }

    public String getIdpeoattainment() {
        return idpeoattainment;
    }

    public void setIdpeoattainment(String idpeoattainment) {
        this.idpeoattainment = idpeoattainment;
    }

    public String getAttainmentlevel() {
        return attainmentlevel;
    }

    public void setAttainmentlevel(String attainmentlevel) {
        this.attainmentlevel = attainmentlevel;
    }

    public String getYea() {
        return yea;
    }

    public void setYea(String yea) {
        this.yea = yea;
    }

    public Survey getSurveyidentifier() {
        return surveyidentifier;
    }

    public void setSurveyidentifier(Survey surveyidentifier) {
        this.surveyidentifier = surveyidentifier;
    }

    public Peo getPeoIdentifier() {
        return peoIdentifier;
    }

    public void setPeoIdentifier(Peo peoIdentifier) {
        this.peoIdentifier = peoIdentifier;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpeoattainment != null ? idpeoattainment.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Peoattainment)) {
            return false;
        }
        Peoattainment other = (Peoattainment) object;
        if ((this.idpeoattainment == null && other.idpeoattainment != null) || (this.idpeoattainment != null && !this.idpeoattainment.equals(other.idpeoattainment))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cse308.entities.Peoattainment[ idpeoattainment=" + idpeoattainment + " ]";
    }
}
